<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<title>jQuery响应式购物车</title>
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="viewport"
		content="width=device-width, initial-scale=1.0,minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<link rel="stylesheet" href="./css/common1.css">
	<link rel="stylesheet" href="./css/cart.css">
</head>

<body>
	<header class="header">
		<span class="headerTitle">我的收藏</span>
		<a href="/member"><span class="headerRight cart-operation edit">返回</span></a>
	</header>

	<main class="main">
		{{each da item}}
		<div class="cart-block">
			<div class="checkbox-wrap">
				<img src="../images/tick.png" class="tick js" data-id="{{item.ids}}">
				<input type="checkbox" name="" id="" value="" class="checkbox mycheckbox" />
			</div>
			<img src="{{item.img}}" class="cart-goods-img">
			<div class="cart-goods-info" data-id="{{item.ids}}">
				<p class="cart-goods-name">{{item.name}}</p>
				<p class="cart-goods-sku">超级秒杀</p>
				<div class="price-wrap">
					<span>￥<span class="price">{{item.price}}</span></span>
					<div class="num-wrap">
						<img src="../images/sub.png" class="sub">
						<input type="number" name="" id="num-input" class="num-input" value="1" readonly />
						<img src="../images/add.png" class="add">
					</div>
				</div>
			</div>
		</div>
		{{/each}}


	</main>


	<div style="height: 0.5rem;"></div>
	<div class="total-wrap">
		<div class="total-left">
			<div class="checkbox-wrap">
				<img src="../images/tick.png" class="tick">
				<input type="checkbox" name="" id="" value="" class="checkbox allselect" />
			</div>
			<span>全选</span>
		</div>
		<div class="total-right settlement">
			<!-- <p>合计:<span class="symbol">￥</span><span class="integer">0</span><span class="point"></span></p> -->
			<button type="button" class="total-btn">删除(<span class="checkedLen">0</span>)</button>
		</div>

		<div class="total-right delete-btn">
			<button type="button" class="total-btn">删除(<span class="checkedLen">0</span>)</button>
		</div>
	</div>

</body>
<script src="./js/jquery.min.js"></script>
<script src="./js/cart.js" type="text/javascript" charset="utf-8"></script>
<script>
	$('.cart-goods-info').click(function (e) {
		location.href = '/detail?id=' + $(this).data('id')
	})
	$('.total-btn').click(function () {
		// $('.js').attr('src').includes('tick.png')
		var es = []
		$('.js').each((id, item) => {
			if (!item.getAttribute('src').includes('tick.png')) {
				es.push({ ids: item.dataset.id })
			}
		})
		$.get('/del1', { es }, (data) => {
			alert(data)
			location.reload()
		})
	})
</script>

</html>